<?

include "funct.php";

if (isset($_POST["nume"], $_POST["parola"])) {
	clean($_POST["nume"]);
	clean($_POST["parola"]);
	$rezultat = mysql_query("select * from " . $db["users"] . " where name='" . $_POST["nume"] . "' and password='" . md5($_POST["parola"]) . "'");
	if (mysql_num_rows($rezultat) == 1) {
		$rand = mysql_fetch_array($rezultat);
		if ($rand["function"] == "suspend")
			message_i($lang["p_suspended"]);
		else {
			$_SESSION["user"] = $rand["id"];
			mysql_query("update " . $db["users"] . " set last_visit='" . ceas() . "', logat='1' where id='" . $rand["id"] . "'");
			header("Location: logged.php");
		}
	}
	else
		message_i($lang["wrong_l"]);
}
else
	iesire();
?>
